use std::ops::Deref;

struct MyBox<T> (T);
impl <T> MyBox<T> {
    pub fn new(x:T) ->MyBox<T> {
        MyBox(x)
    }
}

impl <T> Deref for MyBox<T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}


#[test]
fn test_mybox () {
    let x = 6;
    let y = &x;
    // let mb = MyBox::new(x);
    let mb = MyBox(x);

    assert_eq!(x , *y);
    assert_eq!(x , *mb)
}